<template>
	<view class="yb-flex">
		<yb-image custom-class="yb-file-list-cover" lazy-load :src="item.path" @error="onImageError" mode="aspectFill" v-if="!isShowIcon"></yb-image>
		<yb-icon v-if="isShowIcon" :name="item.type == 'folder' ? 'folder-open-fill' : 'file-fill'" size="75" color="#FFCA28" ></yb-icon>
	</view>
</template>

<script>
	export default {
		props: {
			item: {
				type: Object,
				default () {
					return new Object
				}
			}
		},
		data () {
			return {
				isShowIcon: false
			}
		},
		methods: {
			onImageError (e) {
				this.isShowIcon = true
			}
		}
	}
</script>

<style scoped>
	.yb-file-list-cover {
		width: 75rpx;
		height: 75rpx;
	}
</style>
